#include <logbase.h>
#include <genrand.h>
#include <pthread.h>
#include "heapopt.h"

#define checkHeapMaxSize 10
int main(int argc, char **argv)
{
    struct heapRootInform tmpheap;
    union heapNodeInform node;
    srand(time(NULL));
    heapRootInit(&tmpheap, 1000, 1);
    for(int i = 0; i < checkHeapMaxSize; i++)
    {
        node.keyuint = i;
        logdebugc("%u", node.keyuint);
        heapRootAddNode(&tmpheap, &node);
    }
    heapRootPrintf(&tmpheap);
    while(heapRootGetTop(&tmpheap, &node) > 0)
    {
        logdebugc("%u", node.keyuint);
        // heapRootPrintf(&tmpheap);
    }
    heapRootPrintf(&tmpheap);


    heapRootInit(&tmpheap, 1000, 0);
    for(int i = 0; i < checkHeapMaxSize; i++)
    {
        node.keyuint = rand() % 100;
        logdebugc("%u", node.keyuint);
        heapRootAddNode(&tmpheap, &node);
    }
    heapRootPrintf(&tmpheap);
    while(heapRootGetTop(&tmpheap, &node) > 0)
    {
        logdebugc("%u", node.keyuint);
    }

    heapRootFree(&tmpheap);
}